/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.wider.foundation.event;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

/**
 * This class defines a container for collecting Event(s)
 * @author William Choi <avextk@gmail.com>
 */
public class Events implements Iterator {

    private List<Event> evtlist;
    private Iterator    iteratr;

    /**
     * Constructor for constructing collection of Event(s) from a List of Event(s)
     * @param eventlist A List of Event(s)
     */
    public Events(List<Event> eventlist){
        evtlist = eventlist;
        iteratr = evtlist.iterator();
    }

    /**
     * Constructor for constructing collection of Event(s) from an array of Event(s)
     * @param events    An array of Event(s)
     */
    public Events(Event[] events){
        evtlist = Arrays.asList(events);
        iteratr = evtlist.iterator();
    }


    @Override
    public boolean hasNext() {
        return iteratr.hasNext();
    }

    @Override
    public Object next() {
        return iteratr.next();
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException("This List is READ-ONLY.");
    }



}
